Host *
    IdentitiesOnly yes

{% if virthost_with_private_key %}

Host virthost
    Hostname {{ hostvars[groups['virthost'][0]].ansible_host }}
    IdentityFile {{ hostvars[groups['virthost'][0]].ansible_private_key_file }}
    User {{ ssh_user }}
    StrictHostKeyChecking no
    UserKnownHostsFile=/dev/null

{% else %}

Host virthost
    Hostname {{ hostvars['localhost'].ansible_default_ipv4.address }}
    IdentityFile {{ local_working_dir }}/id_rsa_virt_power
    User {{ ssh_user }}
    StrictHostKeyChecking no
    UserKnownHostsFile=/dev/null

{% endif %}

Host undercloud-root
{% if undercloud_type == 'virtual' %}
    ProxyCommand {{ undercloud_ssh_proxy_command }}
{% else %}
    Hostname {{ undercloud_ip }}
{% endif %}
    IdentityFile {{ hostvars['undercloud'].ansible_private_key_file }}
    User root
    StrictHostKeyChecking no
    UserKnownHostsFile=/dev/null

Host undercloud
{% if undercloud_type == 'virtual' %}
    ProxyCommand {{ undercloud_ssh_proxy_command }}
{% else %}
    Hostname {{ undercloud_ip }}
{% endif %}
    IdentityFile {{ hostvars['undercloud'].ansible_private_key_file }}
    User {{ undercloud_user }}
    StrictHostKeyChecking no
    UserKnownHostsFile=/dev/null

{% if deploy_supplemental_node|bool and (supplemental_node_ip_private is defined or supplemental_node_ip is defined) %}
Host supplemental
    Hostname {{ supplemental_node_ip_private|default(supplemental_node_ip) }}
{% if undercloud_type == 'ovb' %}
    IdentityFile {{ extra_node_key }}
{% else %}
    ProxyCommand {{ supplemental_ssh_proxy_command }}
    IdentityFile {{ local_working_dir }}/id_rsa_supplemental
{% endif %}
    User {{ supplemental_user }}
    StrictHostKeyChecking no
    UserKnownHostsFile=/dev/null
{% endif %}

{% if groups["overcloud"] is defined %}
{% for host in groups["overcloud"] %}

Host {{ host }}
    ProxyCommand ssh -o UserKnownHostsFile=/dev/null -o StrictHostKeyChecking=no -o ConnectTimeout=60 -F {{ local_working_dir }}/ssh.config.ansible undercloud -W {{ hostvars[host].inventory_ip }}:22
    IdentityFile {{ hostvars[host].ansible_private_key_file }}
    User {{ overcloud_user | default ('tripleo-admin') }}
    StrictHostKeyChecking no
    UserKnownHostsFile=/dev/null

{% endfor %}
{% endif %}
